package com.biboheart.breport.engine.compile;

import com.biboheart.breport.template.BrTemplateNode;
import com.biboheart.brick.utils.CheckUtils;

public class ExtractorFactory {
    private static final Extractor extractorDirect = new ExtractorDirect();
    private static final Extractor extractorSourceSingle = new ExtractorExpression();
    public static Extractor getExtractor(BrTemplateNode templateNode) {
        String expression = templateNode.getExpression();
        if (!CheckUtils.isEmpty(expression)) {
            return extractorSourceSingle;
        } else {
            return extractorDirect;
        }
    }
}
